package com.scott.BinaryHeap;

/**
 * @author Scott 2017/11/6 09:53
 */
public class Test {

    public static void main(String[] args) {

        int i;
        int a[] = {10, 40, 30, 60, 90, 70, 20, 50, 80};
        BinaryMaxHeap<Integer> test = new BinaryMaxHeap<>();
        System.out.printf("== 依次添加: ");
        for (i = 0; i < a.length; i++) {
            System.out.printf("%d ", a[i]);
            test.add(a[i]);
        }

        System.out.printf("\n== 最 大 堆: %s", test);

        i = 85;
        test.add(i);
        System.out.printf("\n== 添加元素: %d", i);
        System.out.printf("\n== 最 大 堆: %s", test);

        i=90;
        test.remove(i);
        System.out.printf("\n== 删除元素: %d", i);
        System.out.printf("\n== 最 大 堆: %s", test);
        System.out.printf("\n");
        i=40;
        test.remove(i);
        System.out.printf("\n== 删除元素: %d", i);
        System.out.printf("\n== 最 大 堆: %s", test);
        System.out.printf("\n");

    }
}
